//
//  ByFootBallTitleValueView.m
//  caipiao_ios
//
//  Created by mc on 2018/7/23.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByFootBallTitleValueView.h"

@implementation ByFootBallTitleValueView

- (id)init{
    self = [super init];
    if (self) {
        UILabel *titleLabel = [[UILabel alloc] init];
        [self addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(10);
            make.top.equalTo(self).offset(5);
            make.height.mas_equalTo(@15);
            make.width.mas_equalTo(@45);
        }];
        //titleLabel.text = @"胜平负:";
        titleLabel.font = FONT(12);
        titleLabel.textColor = [UIColor lightGrayColor];
        titleLabel.textAlignment = NSTextAlignmentRight;
        self.titleLabel = titleLabel;
        
        UILabel *valueLabel = [[UILabel alloc] init];
        [self addSubview:valueLabel];
        [valueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(titleLabel.mas_right).offset(10);
            make.top.equalTo(titleLabel.mas_top).offset(0);
            make.right.equalTo(self).offset(-10);
            make.bottom.equalTo(self).offset(-5);
        }];
        valueLabel.text = @"";
        valueLabel.font = FONT(12);
        valueLabel.textColor = BY_THEME_COLOR;
        valueLabel.textAlignment = NSTextAlignmentLeft;
        valueLabel.numberOfLines = 0;
        self.valueLabel = valueLabel;
        
    }
    return self;
}

- (void)setType:(NSInteger)type{// 0 混合投注 1 胜平负 2 让球胜平负  3 总进球 4 比分 5半全场
    _type = type;
    if (_type == 1) {
        self.titleLabel.text = @"胜平负:";
    }else if (_type == 2){
        self.titleLabel.text = @"让球:";
    }else if (_type == 3){
        self.titleLabel.text = @"总进球:";
    }else if (_type == 4){
        self.titleLabel.text = @"比分:";
    }else if (_type == 5){
        self.titleLabel.text = @"半全场:";
    }
}



+ (CGFloat)getHeightWithDataString:(NSString *)string{
    CGFloat Width = SCREEN_WIDTH - 36 - 25 - 15 * 2 - 10 - 75;
    if (string.length == 0) {
        return 0;
    }
    return [string getRectOfStringWithSize:CGSizeMake(Width, 100) font:12].size.height + 15;
}

@end
